Skip to content

Conversation

@akshayvadher
Copy link

Since the readme didn't have a Go port, I only discovered two ports had already been created for Go when I came to PR. My bad.

Anyway, I created one at https://github.com/akshayvadher/cuid2

I have added all the histograms, char frequencies, and collision tests.

I made the syntax and structure as similar as possible so that reviewers could review it easily and make future changes easier.
Instead of removing the first char from the hash, I returned it as it was; the collision and histogram tests were failing (to test out that IDs are correctly generated and tests are correctly testing).

The entropy generator uses global variables (ENV variable keys).

Changes:

  • Instead of ^[0-9a-z]+$, the test CUID function checks for ^[a-z][0-9a-z]+$ for more accurate result
  • For histogram test, instead of dropping the first two chars (.slice(2)), I am dropping only the first for more accurate testing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant